package mystruts;

import com.opensymphony.xwork2.ActionSupport;

public class TestAction extends ActionSupport
{
	public String execute() throws Exception {
		
		this.LOG.debug("Hello_1");
		this.LOG.info("Hello_2");
        System.out.println("TestAction.execute...");
        System.out.println("username:"+ this.getUsername());
        System.out.println("password:"+ this.getPassword());
        String nextpage="";
        if(this.getUsername()==null&&this.getPassword()==null){
        	this.setMes("Welcome!");
        	nextpage="testlogin";
        }
        else if("tom".equals(this.getUsername())&&"1234".equals(this.getPassword())){
        	this.setMes("login sucess!");
        	nextpage="SUCCESS";
        }
        else{
        	this.setMes("please try again");
        	nextpage="testlogin";
        }
        return nextpage;
    }
	
	
	String mes;
	String username;
	String password;
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getMes() {
		return mes;
	}
	public void setMes(String mes) {
		this.mes = mes;
	}
	

}
